package FactoryMode

object SingleLeton {

  private var s: SingleLeton = null

  def getInstance(name: String, age: Int): SingleLeton = {
    if (s == null)
      s = new SingleLeton(name, age)
    s
  }
}

class SingleLeton private(val name: String, val age: Int) {

  override def toString = s"SingleLeton(name=$name, age=$age)"
}
